image: Don't translate twice
authorBenjamin Otte <otte@redhat.com>
Wed, 30 Nov 2016 22:03:13 +0000 (23:03 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 30 Nov 2016 22:54:49 +0000 (23:54 +0100)
The animation can pass x/y through to the render_icon() function, so
don't gtk_snapshot_translate() it.

gtk/gtkimage.c

index 4d5e8d72a3763ff79ca199d5182a268756e5f56d..5be11b8a0bbf6a3eb1a3de5af8ef43bb77f845d3 100644 (file)
@@ -1453,7 +1453,6 @@ gtk_image_render_contents (GtkCssGadget *gadget,
 
   x += (width - w) / 2;
 
-  gtk_snapshot_translate_2d (snapshot, x, y);
   if (gtk_image_get_storage_type (image) == GTK_IMAGE_ANIMATION)
     {
       GtkStyleContext *context = gtk_widget_get_style_context (widget);
@@ -1465,9 +1464,10 @@ gtk_image_render_contents (GtkCssGadget *gadget,
     }
   else
     {
+      gtk_snapshot_translate_2d (snapshot, x, y);
       gtk_icon_helper_snapshot (priv->icon_helper, snapshot);
+      gtk_snapshot_translate_2d (snapshot, -x, -y);
     }
-  gtk_snapshot_translate_2d (snapshot, -x, -y);
 
   return FALSE;
 }